package com.youlai.boot.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.youlai.boot.system.mapper.MedicineMapper;
import com.youlai.boot.system.mapper.SourceMapper;
import com.youlai.boot.system.model.QB.Medicine;
import com.youlai.boot.system.service.MedicineService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class MedicineServiceImpl extends ServiceImpl<MedicineMapper, Medicine> implements MedicineService {
    private static final Logger logger = LoggerFactory.getLogger(DeviceServiceImpl.class);
    @Autowired
    private MedicineMapper medicineMapper;
    @Override
    public boolean saveMedicine(Medicine medicine) {

        medicine.setAddtime(LocalDateTime.now());
        return save(medicine);
    }

    @Override
    public List<Medicine> getAllMedicine() {
        return medicineMapper.selectList(null);
    }

    @Override
    public boolean deleteMedicineById(Integer id) {
        return medicineMapper.deleteById(id) >0;
    }
}
